package cn.tedu.luban.order.main.consumer;

import cn.tedu.luban.order.main.service.OrderFrontService;
import com.tedu.inn.protocol.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@RocketMQMessageListener(topic = "order_delay_topic",consumerGroup = "order_delay_consumer")
@Component
@Slf4j
public class OrderDelayConsumer implements RocketMQListener<String> {
    @Autowired
    private OrderFrontService orderFrontService;
    @Override public void onMessage(String orderNo) {
        try{
            orderFrontService.orderDelay(orderNo);
        }catch ( BusinessException e){
            log.error("订单延迟消息消费失败",e);
        }
    }
}
